package resources;

import java.util.LinkedList;

/**
 *
 * @author Ramunas
 */
public class ResDescriptor {
    protected String name; //isorinis vardas
    protected boolean reusable; //ar pakartotinio naudojimo
    protected Integer creatorId; //sukurusio proceso vidinis vardas
    protected String creatorName;
    protected Access access; //prieinamumo aprasymas
    protected LinkedList<Integer> waitingProcesses;
    
    public ResDescriptor(){
        waitingProcesses = new LinkedList<Integer>();
    }
    
    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the reusable
     */
    public boolean isReusable() {
        return reusable;
    }

    /**
     * @param reusable the reusable to set
     */
    public void setReusable(boolean reusable) {
        this.reusable = reusable;
    }

    /**
     * @return the creator
     */
    public Integer getCreatorId() {
        return creatorId;
    }

    /**
     * @param creator the creator to set
     */
    public void setCreatorId(Integer creatorId) {
        this.creatorId = creatorId;
    }

    /**
     * @return the access
     */
    public Access getAccess() {
        return access;
    }

    /**
     * @param access the access to set
     */
    public void setAccess(Access access) {
        this.access = access;
    }

    /**
     * @return the waitingProcesses
     */
    public LinkedList<Integer> getWaitingProcesses() {
        return waitingProcesses;
    }

    /**
     * @param waitingProcesses the waitingProcesses to set
     */
    public void setWaitingProcesses(LinkedList<Integer> waitingProcesses) {
        this.waitingProcesses = waitingProcesses;
    }
    
    public boolean addWaitingProcesses(Integer process){
        return waitingProcesses.add(process);
    }

    /**
     * @return the creatorName
     */
    public String getCreatorName() {
        return creatorName;
    }

    /**
     * @param creatorName the creatorName to set
     */
    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

   
   private class Access {
       private boolean message; //ar pranesimas ar ismatuojamas
       private int number; //kiek resurso elementu
       private int[] list = new int[number];
       private Integer receiver; //proceso gavejo vidinis vardas
   } 
}
